import { create } from "zustand";
import { persist } from "zustand/middleware";

const initialState = {
  id: 88888,
  name: "admin",
  avatar: "",
  email: "peppapig@gmail.com",
  phone: "13800138000",
};

export const useUserInfoStore = create<typeof initialState>()(
  persist(() => initialState, { name: "app-userinfo" }),
);

export const setUserInfo = (userInfo: typeof initialState) => {
  useUserInfoStore.setState(userInfo);
};

export const getUserInfo = () => {
  return useUserInfoStore.getState();
};
